﻿Namespace Messaging

    <AttributeUsage(AttributeTargets.All)> _
    Public Class MessageMappingAttribute
        Inherits Attribute

        Public Property MessageMappings() As New Dictionary(Of String, MessageType)()

        Public Sub New(ByVal eventNames() As String, ByVal messages() As MessageType)
            If eventNames.Length <> messages.Length Then
                Throw New ArgumentNullException("Event names are not all mapped to one message type.")
            Else
                For i As Integer = 0 To eventNames.Length - 1
                    Me.MessageMappings.Add(eventNames(i), messages(i))
                Next
            End If
        End Sub

    End Class

End Namespace